pets =sc.parallelize([("cat",1),("dog",1),("cat",2)])
pets.reduceByKey(lambda x,y:x+y) # {("cat",3),("dog",1)}
pets.groupByKey() # {("cat",[1,2]),("dog",1)}